#!/bin/bash

if [[ $(id -u) != 0 ]]; then
    echo "Please run as root or use sudo"
    exit 1
fi

set -ex

systemctl stop docker.service

cat << EOF > /etc/docker/daemon.json
{
    "registry-mirrors": [
        "https://mirror.tuna.tsinghua.edu.cn/docker",
        "https://mirror.ccs.tencentyun.com",
        "https://docker.nju.edu.cn",
        "http://hub-mirror.c.163.com",
        "https://docker.rainbond.cc",
        "https://registry.docker-cn.com",
        "https://docker.mirrors.ustc.edu.cn"
    ]
}
EOF

systemctl daemon-reload
systemctl restart docker

